﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DataAccess;
namespace QLDSVCNTT_Nhom1
{
    public partial class frmGVQuanLyDiem : Form
    {
        public static GiaoVien gv;
        public static List<GiaoVien> listgv;
        public frmGVQuanLyDiem()
        {
            InitializeComponent();
        }

        private void frmGVQuanLyDiem_Load(object sender, EventArgs e)
        {
            if (gv != null)
            {
                List<PhanCongGiangDay> list = PhanCongGiangDay.PhancongGiangDay_LoadNamHoc(gv.MaGV);
                cbbNamHoc.DataSource = list;
                cbbNamHoc.DisplayMember = "NamHoc";
                cbbNamHoc.ValueMember = "NamHoc";
                cbbNamHoc.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show("Đang Xây Dựng ^^!, mong các bạn thông cảm"); 
            }
            
        }

        private void cbbNamHoc_SelectedIndexChanged(object sender, EventArgs e)
        {
            PhanCongGiangDay pc = cbbNamHoc.SelectedItem as PhanCongGiangDay;
            List<PhanCongGiangDay> list = PhanCongGiangDay.PhancongGiangDay_LoadNamHoc_HocKy(pc.NamHoc);
            cbbHocKy.DataSource = list;
            cbbHocKy.DisplayMember = "HocKy";
            cbbHocKy.ValueMember = "HocKy";
            cbbHocKy.SelectedIndex = 0;
        }

        private void cbbHocKy_SelectedIndexChanged(object sender, EventArgs e)
        {
            PhanCongGiangDay NamHoc = cbbNamHoc.SelectedItem as PhanCongGiangDay;
            PhanCongGiangDay NamHoc_HocKy = cbbHocKy.SelectedItem as PhanCongGiangDay;
            List<PhanCongGiangDay_GV> list = PhanCongGiangDay_GV.PhancongGiangDay_LoadNamHoc_HocKy_TenMonHoc(gv.MaGV, NamHoc.NamHoc, NamHoc_HocKy.HocKy);
            cbbTenMH.DataSource = list;
            cbbTenMH.DisplayMember = "TenMH";
            cbbTenMH.ValueMember = "MaMH";
        }

        private void cbbTenMH_SelectedIndexChanged(object sender, EventArgs e)
        {
            PhanCongGiangDay_GV pc=cbbTenMH.SelectedItem as PhanCongGiangDay_GV;
            MonHoc mh = MonHoc.TimMHTheoMa(pc.MaMH);
            lbMaMH.Text = mh.MaMH.ToString();
            lbSoTc.Text = mh.SoTC.ToString();
        }
    }
}
